// MainDialog.cpp : implementation file
//

#include "stdafx.h"
#include "MFC10U.h"
#include "MainDialog.h"



// CMainDialog dialog

IMPLEMENT_DYNAMIC(CMainDialog, CDialog)

CMainDialog::CMainDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CMainDialog::IDD, pParent)
{

}

CMainDialog::~CMainDialog()
{
}

void CMainDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CMainDialog, CDialog)
	ON_BN_CLICKED(IDC_BUTTON_START, &CMainDialog::OnBnClickedButtonStart)
	ON_WM_TIMER()
END_MESSAGE_MAP()


// CMainDialog message handlers

void CMainDialog::OnBnClickedButtonStart()
{
	// TODO: Add your control notification handler code here
	if(!cDinputEmulator.IsReady)cDinputEmulator.Init();
	::SetTimer(this->m_hWnd,10,1000,NULL);
}

void CMainDialog::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default
	cDinputEmulator.SetKeyDown('Q');
	HWND target=::FindWindow(NULL,L"DxInput");

	::PostMessage(target,WM_KEYDOWN,VK_DOWN,0);
	::PostMessage(target,WM_KEYUP,VK_DOWN,0);
	//cDinputEmulator->SetKeyUp('Q');
	CDialog::OnTimer(nIDEvent);
}
